# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Amish <contact at via dot aur>
# Contributor: Victor3D <webmaster@victor3d.com.br>

pkgname=fetchmail
pkgver=6.4.37
pkgrel=2
pkgdesc='A remote-mail retrieval utility'
arch=('loong64' 'x86_64')
url='https://www.fetchmail.info'
license=('GPL')
depends=('openssl')
makedepends=('python')
optdepends=('tk: for using fetchmailconf'
            'python-future: for using fetchmailconf')
source=("https://sourceforge.net/projects/fetchmail/files/branch_${pkgver%.*}/${pkgname}-${pkgver}.tar.xz"{,.asc}
        'fetchmail.tmpfiles'
        'fetchmail.sysusers'
        'fetchmail@.service'
        'fetchmail.service')
b2sums=('4dc7d116e9dc32c2ff070f669306d9f2c0f93d5638b748d7362d6c9ab8684ae7ed8e26278ecf63bf23e2fff27916f83f7287aff891bd90bad82793bb84775c40'
        'SKIP'
        'b4ffb99efe4ab24a5a9ed3a27ad5a4645ef8611d66ca380e6acd36e81b34d2619142d62854fa7bd7716b8013d3ccf75ea3e1e18151ae95ff6c37c839631a5733'
        '5000d2daa40cf36e46bd602d8c1ba45840587d289d19254187f92bced1b557a948e72417bbeaa3efd85e7d19f7f257effc310a96359b85eee6ed96d97d44c1b2'
        'b8740cab8a59cc6c3082973e60d3eb262e3a76aa2b0517336d8f95fd4214a5ccbb2e292301d9112ede0747335f7f8d2815eb38b958085f702c01be30aa107f72'
        'a86822f27f5f4c7b97f24baebcd383b5cc2a4fa7810226139e2c588368637417dbfa52f884a8fcc04b904fc1ac865189feb2070a215a8abf9c0192584c2dbbef')
validpgpkeys=('DC4A655BD993CD4871FA8210E412B156EFF3855A') # Matthias Andree

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --with-ssl=/usr
  make
}

package() {
  install -D -m644 fetchmail.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/fetchmail.conf
  install -D -m644 fetchmail.sysusers "${pkgdir}"/usr/lib/sysusers.d/fetchmail.conf
  install -D -m644 fetchmail.service "${pkgdir}"/usr/lib/systemd/system/fetchmail.service
  install -D -m644 fetchmail@.service "${pkgdir}"/usr/lib/systemd/system/fetchmail@.service

  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
